From aa55ec1da2d5a3076e70e42e515e23209e715aa4 Mon Sep 17 00:00:00 2001 From: Joan Torres Lopez Date: Wed, 25 Feb 2026 14:19:41 +0100 Subject: [PATCH] environment: Keep cleanup symmetrical with prepare in ease functions Add a guard to prevent cleanup() from running when prepare() was never called. Currently cleanup() is called when "stopped" is emitted (which ensures prepare() was called), in next commits cleanup will be called from different events which means prepare() may not have been called. Part-of: (cherry picked from commit 841ff6cfa247e69ed2c466c880846d1cceb3eece) --- js/ui/environment.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/ui/environment.js b/js/ui/environment.js index 45dafa9a7..0e0ab2f33 100644 --- a/js/ui/environment.js +++ b/js/ui/environment.js @@ -85,11 +85,15 @@ function _makeEasePrepareAndCleanup(duration) { if (!duration) return {prepare: null, cleanup: null}; + let canCleanup = false; const prepare = () => { global.compositor.disable_unredirect(); global.begin_work(); + canCleanup = true; }; const cleanup = () => { + if (!canCleanup) + return; global.compositor.enable_unredirect(); global.end_work(); }; -- 2.39.5